package com.heima.article;

import com.heima.file.service.FileStorageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@SpringBootTest
@RunWith(SpringRunner.class)
public class UploadTeat {
    @Autowired
    private FileStorageService fileStorageService;

    //测试图片上传
    @Test
    public  void imageTest() throws Exception {
        String path = fileStorageService.uploadImgFile(""
                , "aa.jpg"
                , new FileInputStream(new File("D:\\imgs\\R-C.jfif")));
        System.out.println(path);
    }


    @Test
    public  void htmlTest() throws Exception {
        String path = fileStorageService.uploadHtmlFile(""
                , "bb.html"
                , new FileInputStream(new File("D:\\Java\\index.html")));
        System.out.println(path);
    }
}
